﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using LispInterpretor;

namespace UnitTests
{
    [TestClass]
    public class TestConcat
    {
        [TestMethod]
        [ExpectedException(typeof(InvalidProgramException))]
        public void TestIncorrectArgumentCount()
        {
            Evaluator.Eval("(concat 1)");
        }

        [TestMethod]
        public void TestBasicConcatenation()
        {
            Assert.AreEqual(true, Evaluator.Eval("(= (concat 1 2) (1 2))"));
        }

        [TestMethod]
        public void TestNestedListConcatenation()
        {
            Assert.AreEqual(true, Evaluator.Eval("(= (concat (1 2) (3 4 5)) (1 2 3 4 5))"));
        }

        [TestMethod]
        public void TestPrependToList()
        {
            Assert.AreEqual(true, Evaluator.Eval("(= (concat 1 (2 3 4)) (1 2 3 4))"));
        }

        [TestMethod]
        public void TestAppendToList()
        {
            Assert.AreEqual(true, Evaluator.Eval("(= (concat (1 2 3) 4) (1 2 3 4))"));
        }
    }
}
